﻿
@{
    Layout = null;
}

<!DOCTYPE html>

<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <title>Index</title>
    <script src="~/scripts/jquery.js"></script>
    <script src="~/scripts/jquery.validate.js"></script>
    <script src="~/scripts/messages_zh.js"></script>
</head>
<body>
    <div>
        <p>用户名：@Html.TextBox("username", "", new { @id = "username" })</p>
        <p>密码：@Html.TextBox("password", "", new { @id = "password" })</p>
        <p>确认密码：@Html.TextBox("password2", "", new { @id = "password2" })</p>
        <button type="submit">提交</button>
    </div>
    <script>
        $(document).ready(function (){
            $("form").vallidate({
                ready: {
                    username: { required: true },
                    password: { required: true },
                    password2: { required: true, equalTo: password }
                }, message: {
                    username: { required: "请输入用户名" },
                    password: { required: "请输入密码" },
                    password2: { required: "请确认密码", equalTo:"两次密码不一致" }
                }
            })
        })
    </script>
</body>
</html>
